package com.lightChat.netty.model;

import io.netty.channel.Channel;

import java.util.HashMap;
import java.util.Map;

/**
 * @author sxt
 * @create 2019-11-15 21:16
 */
public class UserChannelMap {
    private static Map<String , Channel> channelMap = new HashMap<>();

    /**
     * 建立userId与channel之间的联系
     * @param userId
     * @param channel
     */
    public static void put(String userId,Channel channel){
        channelMap.put(userId,channel);
    }

    /**
     * 获取用户对应的cahnnel
     * @param userId
     * @return
     */
    public static Channel get(String userId){
        return channelMap.get(userId);
    }

}
